export function useDebounceHook() {
  //防抖
  function debounce(func: Function, wait: number) {
    let timeout: NodeJS.Timeout | null = null
    return function (this: any, ...args: any[]) {
      // eslint-disable-next-line @typescript-eslint/no-this-alias
      const context = this
      if (timeout) clearTimeout(timeout)
      timeout = setTimeout(() => func.apply(context, args), wait)
    }
  }

  return {
    debounce
  }
}
